<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Deepin Search | Created Your Own Ranking Method</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel="stylesheet" href="javascript/themes/base/jquery.ui.all.css">
	<script src="javascript/jquery-1.5.1.js"></script>
	<script src="javascript/ui/jquery.ui.core.js"></script>
	<script src="javascript/ui/jquery.ui.widget.js"></script>
	<script src="javascript/ui/jquery.ui.mouse.js"></script>
	<script src="javascript/ui/jquery.ui.slider.js"></script>
	<link rel="stylesheet" href="javascript/themes/demos.css">
	<script type="text/javascript">

	</script>
	<script src="javascript/core.js"></script>
  </head>

<body onload="load()">
	
	<div style="width:70%; margin:auto; padding:0px;">
		<div id="head" width="100%">
			<form id="search" method="get" action="">
			<table border="0" width="100%" style="margin-top:20px">
				<tr>
					<td width="20%" align="left"><a href="deepin/" style="font-size:30px"><img src="images/logo-middle.jpg" width="200px" height="60px" /></a></td>
					<td width="60%" align="center"><input type="text" name="q" id="q" size="65" style="height:25px; font-size:18px;" /></td>
					<td valign="center" width="20%" align="left"><input type="submit" value="Search"><br/><span style="color:grey; font-size:10px">Results from <a href="http://www.google.com"><img src="images/google_logo1.jpg" alt="google" /></a></span></td>
				</tr>
			</table>
			</form>
			<hr style="color:#E8E8E8;">
		</div>
  
		<?php if(isset($_GET['q'])&$_GET['q']!=NULL){ ?>
  
		<div id="body" width="100%" style="margin-top:0px;">
			<table border="0" width="100%">
				<tr>
					<td valign="top" width="22%" style="padding-left:10px; padding-right:10px; border-right:1px solid #E8E8E8;">

						<div id="custiomized_ranking">
							<table border="0">
								<tr>
									<td><img src="images/created.png" /></td>
									<td><b><span style="font-size:14px;">Create Ranking Method</span></b></td>
								</tr>
							</table>
							<div style="margin-top:7px;margin-bottom:10px;">
								<span>
									<label for="keyword" style="font-size:12px;">Keyword Match:</label>
									<input type="text" size="3" id="keyword" value="10" style="border:0; color:#f6931f; font-weight:bold;" />
								</span>
								<div id="keyword_slider" style="margin-top:7px;"></div>
							</div>
							<hr style="border:1px dotted lightgrey">
							<div style="margin-top:7px;margin-bottom:10px;">
								<span>
									<label for="time" style="font-size:12px;">Date Created:</label>
									<input type="text" size="3" id="time" value="0" style="border:0; color:#f6931f; font-weight:bold;" />
								</span>
								<div id="time_slider" style="margin-top:7px;"></div>
							</div>
							<hr style="border:1px dotted lightgrey">
							<div style="margin-top:2px;margin-bottom:10px;">
								<span>
									<label for="traffic" style="font-size:12px;">Traffic:</label>
									<input type="text" id="traffic" value="0" style="border:0; color:#f6931f; font-weight:bold;" size="3" />
								<div id="traffic_slider" style="margin-top:7px;"></div>
								</span>
							</div>
							<hr style="border:1px dotted lightgrey">
							<div style="margin-top:2px;margin-bottom:10px;">
								<span>
									<label for="quality" style="font-size:12px;">Quality:</label>
									<input type="text" id="quality" value="0" style="border:0; color:#f6931f; font-weight:bold;" size="3"/>
								</span>
								<div id="quality_slider" style="margin-top:7px;"></div>
							</div>
							<hr style="border:1px dotted lightgrey">
							<div style="margin-top:2px;margin-bottom:10px;">
								<span>
									<label for="speed" style="font-size:12px;">Speed:</label>
									<input type="text" id="speed" value="0" style="border:0; color:#f6931f; font-weight:bold;" size="3"/>
								</span>
								<div id="speed_slider" style="margin-top:7px;"></div>
							</div>
							<hr style="border:1px dotted lightgrey">
							<div style="display:none;margin-top:2px;margin-bottom:10px;" id="show_category">
								<label for="category" style="font-size:12px;">Show in Categories:</label>
								<input type="checkbox" id="category" style="border:0; color:#f6931f; font-weight:bold;" onchange="show_ranking()" />
							</div>
						</div>
					</td>
					<td width="78%" style="padding-top:14px;">
						<div id="results_containter" width="100%">
						<?php
							include_once("libraries/google_search.php");
							$id = 0;
							$response = google_search(urlencode($_GET['q']));
							echo "<ul width='100%' id='ranked_result' style=\"list-style-type:none; padding:0px; margin:0px;\">";
							foreach($response as $result){
									echo "<li id=\"".$id."\" style=\"background-image:url(images/arrow.gif); background-repeat:no-repeat; background-position:10px 7px; padding-left:30px;\"><div style='margin-bottom:20px;'>".
										 "<a id='r_subject' href=".$result['url']." style='font-size:18px;'>".$result['title']."</a>".
										 "<p style='margin-top:0px;margin-bottom:0px;font-size:14px;'>".$result['content']."</p>".
										 "<a href=".$result['url']." style='font-size:14px;color:green;'>".$result['visibleUrl']."</a></div></li>";
								$id++;
							}
							echo "</ul>";
						?>
						</div>
					</td>
				</tr>
			</table>
		</div>
		
		<div id="foot" align="center" style="margin-top:10px;">
			<hr style="color:#E8E8E8;">
			<span style="font-size:12px; color:grey;">
				&copy; 2011 for CSCI572 Web Search Engines Course Project @ USC.
				<br />
				Designed by 
				<a href="http://www.saximoer.com/" title="about Wenxu Li" target="_blank">Wenxu Li</a> 
				& <a href="http://www.zhaiziming.com/Welcome.html" title="about Ziming Zhai" target="_blank">Ziming Zhai</a>.
			</span>
		</div>

		<?php } ?>
	</div>
	
	<div id="debug">
	<div>
</body>
</html>